"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.ProgressWebLayout = void 0;

var _react = _interopRequireDefault(require("react"));

var _configContext = require("../../../../extends/configContext");

var _classnames = _interopRequireDefault(require("classnames"));

var _injectValue = require("../../../../utils/inject-value");

var _Circle = _interopRequireDefault(require("./Circle"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var ProgressWebLayout = function ProgressWebLayout(props) {
  var _classNames;

  var type = props.type,
      percent = props.percent,
      text = props.text,
      tips = props.tips,
      theme = props.theme,
      className = props.className,
      style = props.style,
      isShowText = props.isShowText,
      lineWidth = props.lineWidth,
      width = props.width,
      children = props.children;

  var _useConfig = (0, _configContext.useConfig)(),
      clsPrefix = _useConfig.clsPrefix; // Circle


  if (type === 'circle') {
    return /*#__PURE__*/_react.default.createElement(_Circle.default, props);
  }

  return /*#__PURE__*/_react.default.createElement("div", {
    className: (0, _classnames.default)("".concat(clsPrefix, "-progress"), className, (_classNames = {}, _defineProperty(_classNames, "".concat(clsPrefix, "-progress--error"), theme === 'danger'), _defineProperty(_classNames, "".concat(clsPrefix, "-progress--succeed"), theme === 'success'), _classNames)),
    style: style
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: "".concat(clsPrefix, "-progress__value"),
    style: {
      width: "".concat(percent, "%"),
      transition: 'width .2s'
    }
  }, text && /*#__PURE__*/_react.default.createElement("span", {
    className: "".concat(clsPrefix, "-progress__text")
  }, (0, _injectValue.injectValue)(text)(percent))));
};

exports.ProgressWebLayout = ProgressWebLayout;